	/*
	Multi combo
	Use with 'Ext.data.Store'
	If store root note has 'checked' property tree combo becomes multiselect combo (tree store must have records with 'checked' property)
	Has event 'itemclick' that can be used to capture click			
	Options:
	selectChildren - if set true and if store isn't multiselect, clicking on an non-leaf node selects all it's children
	canSelectFolders - if set true and store isn't multiselect clicking on a folder selects that folder also as a value
	Use:
	single leaf node selector:
	selectChildren: false
	canSelectFolders: false
	- this will select only leaf nodes and will not allow selecting non-leaf nodes
	single node selector (can select leaf and non-leaf nodes)
	selectChildren: false
	canSelectFolders: true
	- this will select single value either leaf or non-leaf
	children selector:
	selectChildren: true
	canSelectFolders: true
	- clicking on a node will select it's children and node, clicking on a leaf node will select only that node
	This config:
	selectChildren: true
	canSelectFolders: false
	- is invalid, you cannot select children without node
	{name}should stay the same as display field
	*/

	Ext.define('Ext.ux.combobox.MultiComboBox', {
		extend: 'Ext.form.field.ComboBox',
		alias: 'widget.multicombobox',
		xtype: 'multicombobox',
		initComponent: function(){
			this.multiSelect = true;
			this.listConfig = {
				  itemTpl : Ext.create('Ext.XTemplate',
						"<input type='checkbox' value='{[values."+this.valueField+"]}'/>{"+ this.displayField +"}"),
				  onItemSelect: function(record) {    
					  var node = this.getNode(record);
					  if (node) {
						 Ext.fly(node).addCls(this.selectedItemCls);
						 
						 var checkboxs = node.getElementsByTagName("input");
						 if(checkboxs!=null)
						 {
							 var checkbox = checkboxs[0];
							 checkbox.checked = true;
						 }
					  }
				  },
				  listeners:{
					  itemclick:function(view, record, item, index, e, eOpts ){
						  var isSelected = view.isSelected(item);
						  var checkboxs = item.getElementsByTagName("input");
						  if(checkboxs!=null)
						  {
							  var checkbox = checkboxs[0];
							  if(!isSelected)
							  {
								  checkbox.checked = true;
							  }else{
								  checkbox.checked = false;
							  }
						  }
					  }
				  }    	  
			}   	
			this.callParent();
		}
	});